﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.Coolzon.Configuration.Client
{
    public class HostConfig
    {
        public List<ServiceConfig> ServiceList { get; set; }
        
        public HostConfig()
        {
            ServiceList = new List<ServiceConfig>();
        }

        /// <summary>
        /// 获取服务的配置信息
        /// </summary>
        /// <param name="serviceName"></param>
        /// <returns></returns>
        public ServiceConfig GetServiceConfig(string serviceName)
        {
            if (ServiceList == null)
            {
                return null;
            }

            for (int index = 0; index < ServiceList.Count; index++)
            {
                ServiceConfig config = ServiceList[index];
                if (config.Name == serviceName)
                {
                    return config;
                }
            }
            return null;
        }
    }
}
